#
# author : PytLab <shaozhengjiang@gmail.com>

# -- base setting -- #
set -g default-terminal "screen-256color"
set -g display-time 3000
set -g escape-time 0
set -g history-limit 65535
set -g base-index 1
set -g pane-base-index 1

# Set tmux prefix to <C-a>
set -g prefix C-x
unbind C-b

# -- bind keys -- #
# Set source-file
bind r source-file ~/.tmux.conf \; display ".tmux.conf Reloaded!"
# Split pane.
unbind '"'
bind | splitw -h
unbind '%'
bind - splitw -v

# Copy mode
# copy-mode to vi mode
setw -g mode-keys vi
# enter copy mode
bind Escape copy-mode
# paste buffer
bind C-p pasteb
# select (v)
bind -t vi-copy v begin-selection
# copy (y)
bind -t vi-copy y copy-selection


# Map panel switch.
# Up
bind-key k select-pane -U
# Down
bind-key j select-pane -D
# left
bind-key h select-pane -L
# right
bind-key l select-pane -R
#select last window
bind-key C-l select-window -l

# Resize panel size.
bind < resize-pane -L 10
bind > resize-pane -R 10
bind _ resize-pane -D 10
bind + resize-pane -U 10

# Use mouse to resize panel.
#set -g mouse-utf8 on
# 状态栏
# 颜色
set -g status-bg black
set -g status-fg white

# 对齐方式
set-option -g status-justify centre
# 左下角
set-option -g status-left '#[bg=black,fg=green][#[fg=cyan]#S#[fg=green]]'
set-option -g status-left-length 20

# 窗口列表
setw -g automatic-rename on
set-window-option -g window-status-format '#[dim]#I:#[default]#W#[fg=grey,dim]'
set-window-option -g window-status-current-format '#[fg=cyan,bold]#I#[fg=blue]:#[fg=cyan]#W#[fg=dim]'

  # 右下角
set -g status-right '#[fg=green][#[fg=cyan]%Y-%m-%d#[fg=green]]'
set-window-option -g mode-mouse on
setw -g mouse-resize-pane on
setw -g mouse-select-pane on
setw -g mouse-select-window on
setw -g mode-mouse on